package io.navigation.modules.navigation.controller;

import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.navigation.modules.navigation.entity.UserRecommendEntity;
import io.navigation.modules.navigation.service.UserRecommendService;
import io.navigation.common.utils.PageUtils;
import io.navigation.common.utils.R;



/**
 * 意见表
 *
 * @author sunzhijun
 * @email sunzhijunadmin@163.com
 * @date 2019-04-13 11:54:25
 */
@RestController
@RequestMapping("navigation/userrecommend")
@Api(tags = "意见表控制类")
public class UserRecommendController {
    @Autowired
    private UserRecommendService userRecommendService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("意见信息表列表")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userRecommendService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    @ApiOperation("意见信息表列表详情")
    public R info(@PathVariable("id") String id){
		UserRecommendEntity userRecommend = userRecommendService.selectById(id);

        return R.ok().put("userRecommend", userRecommend);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("意见信息表保存")
    public R save(@RequestBody UserRecommendEntity userRecommend){
		userRecommendService.insert(userRecommend);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    @ApiOperation("意见信息表更新")
    public R update(@RequestBody UserRecommendEntity userRecommend){
		userRecommendService.updateById(userRecommend);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    @ApiOperation("意见信息表删除")
    public R delete(@RequestBody String id){
		userRecommendService.deleteById(id);

        return R.ok();
    }

}
